<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 
<%@ page import="com.pignest.hotel.system.Global" %><%@ page import="com.pignest.hotel.beans.global.Menu" %>
<%@ page import="java.util.List" %><%@ page import="com.pignest.hotel.system.Hotel" %>
<% String contextPath = request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head> 
<title><%=com.pignest.hotel.system.Config.getHotelName()%></title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<%=contextPath%>/images/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="<%=contextPath%>/dwr/interface/GlobalAjax.js"></script>
<script type="text/javascript" src="<%=contextPath%>/dwr/engine.js"></script>
<script type="text/javascript" src="<%=contextPath%>/scripts/jquery.js"></script>
<script type="text/javascript" src="<%=contextPath%>/scripts/jquery.timer.js"></script>
<style type="text/css">
* {
	margin:0px;
	padding:0px;
}
html, body {
	height:100%;
	overflow: hidden;
}
body {
	border:0px solid #ffff00;
	background-color: #ffffff;
}

img{ border: 0pt; }

#vista_toolbar {
	float:left;
	font:normal 12px 'Trebuchet MS','Arial';
	margin:0;
	padding:0;
	width:100%;
}

#vista_toolbar ul {
	background-image:url(images/home/back.gif);
	background-repeat:repeat-x;
	float:left;
	line-height:32px;
	list-style:none;
	margin:0;
	width:100%;
}

#vista_toolbar li {
	display:inline;
	padding:0;
}

#vista_toolbar a {
	color:#FFF; /* 默认链接颜色 */
	float:left;
	padding:0 3px 0 3px; /* left.png 需要3px */ 
	text-decoration:none;
}

#vista_toolbar a span {
	display:block;
	float:none;
	padding:0 10px 0 7px;
}

#vista_toolbar a span img {
	border:none;
	margin:8px 4px 0 0;
}

/* 鼠标移上去时显示图片 */
#vista_toolbar a:hover{
	background: url(images/home/left.png) no-repeat left center;
}

#vista_toolbar a:hover span {
	background:url(images/home/right.png) no-repeat right center;
}

#vista_toolbar a.right {
	float:right; /* 帮助，要浮动到右边 */
}

#bottom_div{
	clear:both;
	height:95%;
}
</style> 

</head>

<body topmargin="0px" leftmargin="0px">
<div id="vista_toolbar">
	<ul>
<%
List<Menu> menus = Global.getMainMenus();
if (contextPath == null || contextPath.length() <= 1)
	contextPath = "";
String homePage = null;
for (int i=0, j=menus == null ? 0 : menus.size(); i<j; i++) {
	Menu menu = (Menu)menus.get(i);
	String align = menu.getParameter();
	if (!"right".equals(align))
		align = "left";
	String url = Hotel.formatUrl(menu.getUrl());
	if (homePage == null)
		homePage = url;
	String icon = Hotel.formatUrl(menu.getIcon());
%>
		<li><a href="<%=url%>">
			<span><img align="left" src="<%=icon%>" /><%=menu.getName()%></span>
		</a></li> 
<%}%>
		<li><a id="logoutButton" class="right" href="<%=contextPath %>/modules/global/logout.jsp">
			<span><img align="left" src="<%=contextPath %>/images/power_off.png" />退出</span>
		</a></li>
		<li><a class="right" href="<%=contextPath %>/modules/user/profile.jsp">
			<span><img align="left" src="<%=contextPath %>/images/home/desktop.png" />我的工作台</span>
		</a></li>
		<li>
			<span style="float:right;">欢迎<span style="color:red;"><%=Hotel.getCurrentUser().getDisplayName()%></span></span>
		</li>
	</ul>
</div>
<div id="bottom_div"> 
	<iframe src="<%=contextPath %>/modules/global/welcome.jsp" name="iframe" id="iframe" frameborder="0" scrolling="no" width="100%" height="100%"></iframe>
</div>
</body>
<script type="text/javascript">
function jumpTo(url) {
	document.getElementById("iframe").src=url;
}
$(function(){
//	jumpTo("<%=homePage %>");
	$("#iframe").height($(document).height() - $("#vista_toolbar").height() + 1);
	$("#vista_toolbar a").focus(function(){
		$(this).blur();
	}).each(function(){
		$(this).get(0).target = "_blank";
	}).click(function(){
		jumpTo(this.href);
//		$(this).get(0).target = "_blank";
		return false;
	});
	$("#logoutButton").click(function(){
		if (window.confirm("是否要退出当前登录?")){
			GlobalAjax.logout(function(data){
				window.location.href="<%=contextPath %>/modules/global/login.jsp";
			});
		}
		return false;
	});
	$("body").everyTime('1m', function(){
		GlobalAjax.checkSession(function(data){
			if (!data)
				window.location.href="<%=contextPath %>/modules/global/login.jsp";
		});
	});
	window.onresize = function() {
		$("#iframe").height($(document).height() - $("#vista_toolbar").height() + 1);
	};
});

</script>
</html>